<template>
  <div>
    <div class="head">
      <span>招生数据目录生成</span>
    </div>

    <button>
      <a :href="url(this.param)" download="共享目录.zip">目录下载</a>
    </button>
    <footer>注：招生数据目录下载后请自行解压</footer>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      param: '',
    };
  },
  methods: {
    url(val) {
      return "http://" + window.location.host + val;
    },
  },
  beforeCreate() {
    if (sessionStorage.getItem("token") == null) {
      this.$router.push("/login");
    } else {
      let token = sessionStorage.getItem("token");
      let length = sessionStorage.getItem("token").length;
      if (token[length - 4] == "0") {
        this.$router.replace("/login");
      }
    }
  },
  created() {
    if(window.location.host == '175.27.165.25:8080') {
      this.param = '/dist/catalog.zip'
    }else {
      this.param = '/catalog.zip'
    }
  },
  components: {},
};
</script>

<style scoped>
.head {
  height: 80px;
  border-bottom: 1px solid black;
}
.head span {
  font-size: 20px;
  line-height: 80px;
  margin-left: 25px;
}
a {
  display: inline-block;
  width: 120px;
  height: 50px;
  line-height: 50px;
  text-decoration: none;
  color: #fff;
}
button {
  margin: 250px 0 0 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 50px;
  border: none;
  outline: none;
  cursor: pointer;
  color: #fff;
  background-color: rgb(192, 51, 56);
}
button:active {
  opacity: .8;
}
footer {
  height: 50px;
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}
</style>